import 'package:flutter/material.dart';
import 'package:hao_ke/consts/consts.dart';
import 'package:hao_ke/pages/chat/chat.dart';
import 'package:hao_ke/pages/home/index_page.dart';
import 'package:hao_ke/pages/info/info_page.dart';
import 'package:hao_ke/pages/my/my.dart';

class HomePage extends StatefulWidget {

  const HomePage({super.key});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _HomePageState();
  }

}

class _HomePageState extends State<HomePage> {

  int currentIndex = 0;

  List<Widget> pageList = [
    IndexPage(),
    Chat(),
    InfoPage(),
    My(),
  ];


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Consts.content_color,
      body: pageList[currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home),label: '首页'),
          BottomNavigationBarItem(icon: Icon(Icons.chat),label: 'GPT'),
          BottomNavigationBarItem(icon: Icon(Icons.badge_outlined),label: '项目'),
          BottomNavigationBarItem(icon: Icon(Icons.account_circle),label: '我的'),
        ],
        currentIndex: currentIndex,
        onTap: (value) {
          print(value);
          setState(() {
            currentIndex = value;
          });
        },
      ),
    );
  }
}
